<template>
  <el-header style="background-color: lightgray; text-align: right; font-size: 12px; height: 100px;">
    <h1 style="font-size: 30px; text-align: left;">费用记录查询</h1>
    <div class="toolbar">
      <div>系统希望您不再是本系统受众，并提醒您务必谨遵医嘱</div>
      <div class="sub-title"></div>
    </div>
  </el-header>

  <h3>精准搜索</h3>
  <el-row>
    <el-col :span="6">
      <el-form-item label="病历号" prop="orderNo" class="label">
        <el-input v-model="form.orderNo" placeholder="请输入病历号" />
      </el-form-item>
    </el-col>
    <el-col :span="8">
      <el-form-item label="姓名" prop="patientName" class="label">
        <el-input v-model="form.patientName" placeholder="请输入您的姓名" />
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-button type="primary" @click="search">搜索</el-button>
      <el-button type="primary" @click="resetForm">重置</el-button>
    </el-col>
  </el-row>

  <h3>按条件筛选</h3>
  <el-row>
    <el-col :span="6">
      <el-form-item label="消费项：" prop="consumeOptions" class="label">
        <el-select v-model="form.consumeOptions" placeholder="请选择">
          <el-option label="全部" value="1"></el-option>
          <el-option label="待挂号" value="2"></el-option>
          <el-option label="已挂号" value="3"></el-option>
          <el-option label="已取消" value="4"></el-option>
        </el-select>
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="时间范围：">
        <el-date-picker
          v-model="form.noPayTime"
          type="daterange"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :shortcuts="shortcuts"
          :size="size"
          style="width: 200px;"
        />
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="费用状态：" prop="payStatus" class="label">
        <el-select v-model="form.payStatus" placeholder="请选择收费状态">
          <el-option label="全部" value="1"></el-option>
          <el-option label="待挂号" value="2"></el-option>
          <el-option label="已挂号" value="3"></el-option>
          <el-option label="已取消" value="4"></el-option>
        </el-select>
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-button type="primary" @click="select">查询</el-button>
      <el-button type="primary" @click="resetForm">重置</el-button>
    </el-col>
  </el-row>

  <el-main>
     
      <el-table :data="tableData">
        <el-table-column prop="oNo" label="病历号" />
        <el-table-column prop="pName" label="姓名" />
        <el-table-column prop="consumeName" label="消费名称" />
        <el-table-column prop="price" label="单价" />
        <el-table-column prop="amount" label="数量" />
        <el-table-column prop="pStatus" label="费用状态" />
        <el-table-column prop="payMethod" label="结算方式" />
        <el-table-column prop="optionDate" label="操作时间" />
      </el-table>
      <div class="demo-pagination-block" style="display: flex; justify-content: space-around; align-items: center;">
  <div class="demonstration">
    <el-button type="primary" @click="handleCounts">批量操作: {{ tableData.length }}条</el-button> 
  </div>
  <el-pagination
    v-model:current-page="currentPage4"
    v-model:page-size="pageSize4"
    :page-sizes="[10, 50, 100, 200]"
    :size="size"
    :disabled="disabled"
    :background="background"
    layout="sizes, prev, pager, next, jumper"
    hide-on-single-page:true
    prev-text="上一页"
    next-text="下一页"
    jump-text="'跳至'"
    :page-count="10"
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
  />
</div>
  </el-main>
</template>
   
<script lang="ts" setup name="Order">
import axiosInstance from '@/utils/axiosUtils';
import type { ComponentSize } from 'element-plus'
import { ref } from 'vue';
import { reactive, toRefs } from 'vue'
const currentPage4 = ref(1)
const pageSize4 = ref(10)
const size = ref<ComponentSize>('default')
const background = ref(true)
const disabled = ref(false)
const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`)
}
const handleCounts = () => {
  console.log('批量操作')
}
const form = reactive({
    orderNo: '',
    patientName: '',
    consumeOptions: '',
    noPayTime: '',
    payStatus: ''
 });
const tableData =reactive( [{  oNo: '123456',
    pName: '张三',
    consumeName: '门诊挂号',
    price: '100',
    amount: '1',
    pSatus: '待支付',
    payMethod: '微信',
    optionDate: '2022-01-01'
}])
const shortcuts = [
  {
    text: 'Last week',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      return [start, end]
    },
  },
  {
    text: 'Last month',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      return [start, end]
    },
  },
  {
    text: 'Last 3 months',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
      return [start, end]
    },
  },
]


 //清空表单函数
 const resetForm=()=>{
  for(const key in form){
    form[key]='';
  }
 };
const search=()=>{
};
const select=()=>{
};

</script>






<style lang="css" link-ref="main.css"/>
 <style scoped> 
  h1{
    padding-left: 30px;
    
  }
 .label{
  width: 200px;
   color: grey;
  padding-left: 30px;
  
 }
 
 h3{
  padding-left: 20px;
 }
 .demo-basic {
  text-align: right;
}
.demo-basic .sub-title {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--el-text-color-secondary);
}
.demo-basic .demo-basic--circle,
.demo-basic .demo-basic--square {
  display: flex;
  justify-content: flex-end;
  align-items: right;
}
.demo-basic .block:not(:last-child) {
  border-right: 1px solid var(--el-border-color);
}
.demo-basic .block {
  flex: 1;
}
.demo-basic .el-col:not(:last-child) {
  border-right: 1px solid var(--el-border-color);
}


</style>